package com.mk.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mk.model.dto.picture.*;
import com.mk.model.entity.Picture;
import com.mk.model.entity.User;
import com.mk.model.vo.picture.PictureVO;

/**
* @author zkm
* @description 针对表【picture(图片)】的数据库操作Service
* @createDate 2024-12-19 14:42:13
*/
public interface PictureService extends IService<Picture> {

    /**
     * 图片上传
     * @param pictureUploadRequest
     * @return
     */
    PictureVO uploadPicture(PictureUploadRequest pictureUploadRequest, Object inputSource, User loginUser);

    /**
     * 根据ID删除图片，伴随删除对象存储中的图片
     * @param id
     */
    void deletePicture(Long id, User loginUser);

    /**
     * 编辑图片
     */
    void editPicture(PictureEditRequest editRequest, User loginUser);

    /**
     * 批量抓取和创建图片
     *
     * @param pictureUploadByBatchRequest
     * @param loginUser
     * @return 成功创建的图片数
     */
    Integer uploadPictureByBatch(
            PictureUploadByBatchRequest pictureUploadByBatchRequest,
            User loginUser
    );


    /**
     * 动态构造查询条件
     * @param queryRequest
     * @return
     */
    QueryWrapper<Picture> queryWrapper(PictureQueryRequest queryRequest);

    /**
     * 获取单个图片VO
     * @return
     */
    PictureVO getPictureVOById(Long id, User login);

    /**
     * 分页获取图片封装
     * @param picturePage
     * @return
     */
    Page<PictureVO> getPictureVOPage(Page<Picture> picturePage);

    /**
     * 图片审核
     *
     * @param pictureReviewRequest
     */
    void doPictureReview(PictureReviewRequest pictureReviewRequest, User loginUser);


    void fillReviewParams(Picture picture, User loginUser);

    /**
     * 图片校验
     * @param picture
     */
    void validPicture(Picture picture);

    void checkPictureAuth(User loginUser, Picture picture);

    void clearPictureFile(Picture picture);
}
